import request from "@/utils/request";

/**
 * @function 获取列表数据
 * **/
export const listApi = (params) => {
  return request.get('/sys/dict/type/page', {params})
}

/**
 * @function 创建字典
 * **/
export const createApi = (data) => {
  return request.post('/sys/dict/type', data)
}

/**
 * @function 获取字典详情
 * **/
export const getInfoApi = (id) => {
  return request.get(`/sys/dict/type/${id}`)
}

/**
 * @function 更新字典
 * **/
export const updataApi = (data) => {
  return request.put('/sys/dict/type', data)
}

/**
 * @function 删除字典
 * **/
export const deleteApi = (ids) => {
  return request.delete('/sys/dict/type', {data:ids})
}

// 字典数据
/**
 * @function 获取字典数据列表
 * @param {string} dictTypeId 字典的id /sys/dict/data/page
 * **/
export const dictListPageApi = (params) => {
  return request.get('/sys/dict/data/page', {params})
}

/**
 * @function 创建字典值
 * **/
export const createDictApi = (data) => {
  return request.post('/sys/dict/data', data)
}

/**
 * @function 获取字典详情
 * **/
export const dictDetailApi = (id) => {
  return request.get(`/sys/dict/data/${id}`)
}

/**
 * @function 更新字典
 * **/
export const updataDictApi = (data) => {
  return request.put('/sys/dict/data', data)
}

/**
 * @function 删除字典
 * **/
export const deleteDictApi = (ids) => {
  return request.delete('/sys/dict/data', {data:ids})
}

/**
 * @function 获取所有字典数据
 * **/
export const dictAllApi = () => {
  return request.get('/sys/dict/type/all')
}
